<html>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<script src="js/jquery-3.4.1.js"></script>
<script src="js/jquery.form.js"></script>

<script type="text/javascript">
    $(function () {
        $("#sub").bind("click",function () {
            var option = {
                type:"post",
                url:"http://192.168.3.13:8080/oa_system/studentServlet?method=importStu",
                async: true,
                enctype:"multipart/form-data",
                dataType:"json",
                error:function(data){
                    alert("error");
                },
                success:function(msg){
                    alert("访问成功");
                    console.log(msg);
                }
            };
            $("#fileForm").ajaxSubmit(option);
            $(this).resetForm();
            return false;// 阻止表单自动提交事件，必须返回false，否则表单会自己再做一次提交操作，并且页面跳转
        })
    });

</script>
<head>
    <title>学生信息批量导入</title>
</head>
<body>
<form action="" id="fileForm" enctype="multipart/form-data" method="post" >
    <input type="file" name="file"/><br>
    <button type="submit"  name="sub" id="sub">提交</button>
</form>
</body>
</html>
